package thread;

public class threadDeom7 {
    public static boolean isQuit=true;
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
            while (isQuit){
                System.out.println("这是一个thread线程,在工作");
                try {
                    Thread.sleep(2000);
                }catch (InterruptedException e){
                    throw new RuntimeException();
                }
            }
            System.out.println("线程结束");
        });
        t.start();
        Thread.sleep(4000);
        System.out.println("让t线程结束");
        isQuit=false;
    }
}
